import buildingApi from '@/config/server/api/building'
import dt from '@dt/dt'
//获取案场详情
function housesGetDetail(params) {
  return buildingApi.basicInformation.housesGetDetail.fetch(params)
}
// 获取指定案场所有开盘批次
function batchList(params) {
  return buildingApi.openingBatch.batchList.fetch(params)
}
function batchEdit(params) {
  return buildingApi.openingBatch.batchEdit.fetch(params)
}

function batchBind(params) {
  return buildingApi.openingBatch.batchBind.fetch(params)
}

// 获取指定案场所有开盘批次
function batchDel(params) {
  return buildingApi.openingBatch.batchDel.fetch(params)
}
// 新增/编辑开盘批次 
function batchSaveOrEdit(params) {
  return buildingApi.openingBatch.batchSaveOrEdit.fetch(params)
}
// 新增/编辑开盘批次 
function getBatchDetail(params) {
  return buildingApi.openingBatch.getBatchDetail.fetch(params).then(res => {
    let file = []
    res.imageVOS &&
      res.imageVOS.map((item) => {
        let uploadList = {
          url: item.imageURL,
          name: item.imageId,
        }
        file.push(uploadList)
      })
    res.file = file
    return res
  })
}

function cancelBatchBind(params) {
  return buildingApi.salesControl.cancelBatchBind.fetch(params)
}

function proBuildingList(params) {
  return buildingApi.salesControl.proBuildingList.fetch(params)
}

function updateBatchAttach(params) {
  return buildingApi.openingBatch.updateBatchAttach.fetch(params)
}
export default {
  housesGetDetail,
  batchList,
  batchEdit,
  batchDel,
  batchSaveOrEdit,
  getBatchDetail,
  batchBind,
  cancelBatchBind,
  proBuildingList,
  updateBatchAttach
}